layui.use(['form', 'jquery', 'layer', 'table', 'laydate'], function() {
	var form = layui.form;
	var $ = layui.$;
	var table = layui.table;
	var layer = layui.layer;
	var laydate = layui.laydate;

	var lay_filter = 'tpl_fingerprint';
	// 监听提交
	form.on('submit(submit_fingerprint)', function(data) {
		var field = data.field;
		var url = $('form[lay-filter="' + lay_filter + '"]').attr('action');
		
		if (field.fingerprint == '') {
			layer.msg('指纹必须填写', {
				icon: 2,
				amim: 6
			})
			$('input[name="fingerprint"]').addClass('.layui-form-danger').focus();
			return false;
		}
		send_info(url, field, function(data) {
			if (data.code == 1) {
				layer.msg('保存成功', {
					icon: 1
				});
				$('input[name="fingerprint"]').val('')
				setTimeout(()=>{
					location.reload()
				},1500)
				
			} else {
				layer.msg(data.msg, {
					icon: 2,
					anim: 6
				});
			}
		})
		return false;
	})
	// 删除指纹
	$('.del-finger').on('click',function(){
		var id = $(this).attr('data-id');
		layer.confirm('确定要删除吗？',{title:'温馨提示'},()=>{
			send_info(del_src,{id:id},(data)=>{
				layer.msg('删除成功',{
					icon:1
				})
				setTimeout(()=>{
					location.reload()
				},1500)
			})
		})
	})

})